/*
 * @Author: Njpyy
 * @Date: 2024-03-16 23:45:16
 * @LastEditors: Njpyy
 * @LastEditTime: 2024-03-17 09:46:38
 * @FilePath: /big-event/src/store/token.js
 * @Description: 
 */
import { defineStore } from "pinia";
import { ref } from "vue";

export const useTokenStore = defineStore('token', () => {
    //定义token
    const token = ref('')

    //set方法
    const setToken = (newToken) => {
        token.value = newToken
    }

    //remove方法
    const removeToken = () => {
        token.value = ''
    }

    return {
        token,
        setToken,
        removeToken
    }
    },
    {
        persist: true //持久化存储
    }
)